#pragma once

#include <QString>
#include <QVariantMap>

namespace TCServer
{
	namespace Type
	{
		class NewsGroup
		{
		public:
			quint64 id;
			QString name;
			QString iconUrl;
			bool operator == (const NewsGroup &rhs) const
			{
				return name == rhs.name
					&& iconUrl == rhs.iconUrl;
			}

			static NewsGroup fromVariantMap(const QVariantMap &args)
			{
				Type::NewsGroup val;
				if (args.count("id"))
					val.id = args.value("id").toULongLong();
				val.name = args.value("name").toString();
				val.iconUrl = args.value("iconUrl").toString();
				return std::move(val);
			}

			QVariantMap toVairantMap() const
			{
				return QVariantMap {
					{ "id", id },
					{ "name", name },
					{ "iconUrl", iconUrl },
				};
			}

		};
	}
}